import { InfoCrudMixin } from 'lin-mizar';
import { merge } from 'lodash';
import { Sequelize, Model } from 'sequelize';
import sequelize from '../lib/db';
class AppUser extends Model {
}

AppUser.init(
  {
    id: {
      type: Sequelize.INTEGER,
      primaryKey: true,
      autoIncrement: true
    },
    phone: {
      type: Sequelize.STRING(32)
    },
    email: {
      type: Sequelize.STRING(64)
    },
    avatar: {
      type: Sequelize.STRING(256)
    },
    gender: {
      type: Sequelize.INTEGER
    },
    nickName: {
      type: Sequelize.STRING(32)
    },
    realName: {
      type: Sequelize.STRING(32)
    },
    openid: {
      type: Sequelize.STRING(64)
    },
    session_key: {
      type: Sequelize.STRING(64)
    },
    province: {
      type: Sequelize.STRING(32)
    },
    city: {
      type: Sequelize.STRING(32)
    },
    country: {
      type: Sequelize.STRING(32)
    },
    birth: {
      type: Sequelize.STRING(32)
    }
  },
  merge(
    {
      sequelize,
      tableName: 'app_user',
      modelName: 'app_user'
    },
    InfoCrudMixin.options
  ));

export { AppUser as AppUserModel };